package models;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Transient;

import play.db.jpa.Model;

//购物车收藏夹功能表
@Entity
public class UserCar extends Model {

	public Long booid;

	@Column(columnDefinition = "int(7)")
	public Integer count;

	//用户id
	public String userid;
	
	@Transient
	public Book boo;

	// 0购物车中,1收藏夹中
	@Column(columnDefinition = "int(1)")
	public Integer type;

	public Book getBoo() {
		try {
			this.boo = Book.findById(this.booid);
		} catch (Exception e) {
			this.boo = null;
		}
		return boo;
	}

	public void setBoo(Book boo) {
		this.boo = boo;
	}

}
